﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace hm1_1
{
    public class Stack<T>
    {
        private static int Max = 10;
        T[] stack = new T[Max];
        private int stackTop = 0;

        public void pushStack(T i)
        {
            stack[stackTop] = i;
            stackTop++;
            if (stackTop >= Max)
            {
                stackTop = 10;
                throw new IndexOutOfRangeException();
            }
        }

        public string popStack()
        {
            stackTop--;
            if (stackTop < 0)
            {
                stackTop = 0;
                throw new IndexOutOfRangeException();
            }
            return stack[stackTop].ToString();
        }

    }
}
